import { lazy } from "react";
import { createBrowserRouter } from 'react-router-dom'
import {
    MenuFoldOutlined,
    UploadOutlined,
    UserOutlined,
    VideoCameraOutlined,
    TikTokOutlined,
    GithubOutlined,
    CoffeeOutlined,
    RocketOutlined
    // FrownOutlined,
} from '@ant-design/icons';

// 一二级
const App = lazy(() => import('@/App'))
const Login = lazy(() => import('@/pages/login/Index'))
const Home = lazy(() => import('@/pages/home/Index'))
const Wen = lazy(() => import('@/pages/wen/Index'))
const Tong = lazy(() => import('@/pages/tong/Index'))
const Error = lazy(() => import('@/pages/error/Index'))
const Alova = lazy(() => import('@/pages/alova/Index'))
const Jian = lazy(() => import('@/pages/jian/Index'))
const Naive = lazy(() => import('@/pages/naive/Index'))
const Duo = lazy(() => import('@/pages/duo/Index'))
const Guan = lazy(() => import('@/pages/guan/Index'))
const About = lazy(() => import('@/pages/about/Index'))
// 三级
const Wen1 = lazy(() => import('@/pages/wen/wen1/Index'))
const T1 = lazy(() => import('@/pages/tong/t1/Index'))
const T2 = lazy(() => import('@/pages/tong/t2/Index'))
const E1 = lazy(() => import('@/pages/error/e1/Index'))

type homeRouter = {
    path: string;
    element: JSX.Element;
    children?: homeRouter;
    icon?: any;
    label?: string;
}[]

export const homeRoutes: homeRouter = [
    {
        path: '/home',
        element: <Home></Home>,
        icon: <MenuFoldOutlined />,
        label: '首页'
    },
    {
        path: '/wen',
        element: <Wen></Wen>,
        icon: <UploadOutlined />,
        label: '文档',
        children: [
            {
                path: '/wen/wen1',
                element: <Wen1></Wen1>,
                icon: <MenuFoldOutlined />,
                label: '文档111',
            }
        ]
    },
    {
        path: '/tong',
        element: <Tong></Tong>,
        icon: <UserOutlined />,
        label: '系统功能',
        children: [
            {
                path: '/tong/t1',
                element: <T1></T1>,
                icon: <UserOutlined />,
                label: '标签',
            },
            {
                path: '/tong/t2',
                element: <T2></T2>,
                icon: <UserOutlined />,
                label: '隐藏子菜单',
            },
        ]
    },
    {
        path: '/error',
        element: <Error></Error>,
        icon: <GithubOutlined />,
        label: '异常页',
        children: [
            {
                path: '/error/e1',
                element: <E1></E1>,
                icon: <GithubOutlined />,
                label: '异常页1',
            }
        ]
    },
    {
        path: '/alova',
        element: <Alova></Alova>,
        icon: <TikTokOutlined />,
        label: 'alova示例'
    },
    {
        path: '/jian',
        element: <Jian></Jian>,
        icon: <CoffeeOutlined />,
        label: '插件示例'
    },
    {
        path: '/naive',
        element: <Naive></Naive>,
        icon: <VideoCameraOutlined />,
        label: 'Pro Naive UI 示例'
    },
    {
        path: '/duo',
        element: <Duo></Duo>,
        icon: <RocketOutlined />,
        label: '多级菜单'
    },
    {
        path: '/guan',
        element: <Guan></Guan>,
        icon: <VideoCameraOutlined />,
        label: '系统管理'
    },
    {
        path: '/about',
        element: <About></About>,
        icon: <MenuFoldOutlined />,
        label: '关于'
    },
]

const routes: homeRouter = [
    {
        path: '/',
        element: <App></App>,
        children: homeRoutes
    },
    {
        path: '/login',
        element: <Login></Login>,
    }
]
const router = createBrowserRouter(routes)

export default router